package com.ibm.spatiotemp.server.framework.processor;

import org.apache.log4j.Logger;

import com.ibm.spatiotemp.server.datamodel.gpsdata.TSPointResultSet;
import com.ibm.spatiotemp.server.datasources.DataSource;
import com.ibm.spatiotemp.server.datasources.RawDataAccessor;
import com.ibm.spatiotemp.server.datasources.RawDataAccessorFactory;
import com.ibm.spatiotemp.server.framework.request.Request;

public abstract class RawDataProcessor {
	public static Logger logger = Logger.getLogger(RawDataProcessor.class);
	
	protected RawDataAccessor dataaccessor;
	protected DataSource dbsource;
	public RawDataProcessor(DataSource src)
	{
		this.dbsource = src;
		dataaccessor = RawDataAccessorFactory.getDataAccessorInstanceByDataSource(dbsource);
		if(dataaccessor==null)
		{
			logger.error("cannot create vaild dataaccessor");
		}
		else
		{
			try {
				dataaccessor.connect();
			} catch (Exception e) {
				logger.error("cannot create connection for dataaccessor");
			}
		}
	}
	
	public abstract TSPointResultSet handleRawDataQuery(Request request) throws Exception;
	public abstract String handleRawDataInsert(Request request) throws Exception;

}
